import * as fgui from "fairygui-cc";
import AbstractUIWindow from "../../window/AbstractUIWindow";
import UICore from "../../../../Core/Res/UICore";
import ModuleWindow from "../../window/ModuleWindow";
import WindowObject from "../../window/WindowObject";
import EventMgr from "../../../../Core/Event/EventMgr";

/**已弃用 */
export class SettlementWindow extends AbstractUIWindow {
    private desc: fgui.GTextField;
    private again: fgui.GButton;
    private exit: fgui.GButton;
    protected getResList(): Array<string> {
        return [`Plane`];
    }
    protected onInit(): void {
        this._view = UICore.createObject("Plane", "SettlementWindow").asCom;
    }
    protected onShow(iswin: boolean): void {
        if (iswin) {
            this.desc.text = `恭喜你获得了胜利`;
        } else {
            this.desc.text = `很遗憾你失败了`;
        }
        this.again.onClick(this.clickAgain, this);
        this.exit.onClick(this.clickExit, this);
    }
    private clickAgain(): void {
        this.close();
        EventMgr.emit("restart");

    }
    private clickExit(): void {
        this.close();
        EventMgr.emit("closeRobot");
    }
}